<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>正则表达式</title>
    <script>
        {
            // let reg1 = new RegExp("uek");
            // console.log(reg1.test("sxuek"));
            // let reg2 = /zzk/;
            // console.log(reg2.test("sxzza"));
            // let reg3 = /zzk\d/;
            // console.log(reg3.test("sxzzk1"));
            // let reg4 = /zzk\D/;
            // console.log(reg4.test("sxzzk+"));
            // let reg5 = /zzk\s/;
            // console.log(reg5.test("sxzzk "));
            // let reg6 = /zzk\S/;
            // console.log(reg6.test("sxzzk "));
            // let reg7 = /zzk\w/;
            // console.log(reg7.test("sxzzk_"));
            // let reg8 = /zzk\W/;
            // console.log(reg8.test("sxzzkA"));
            // let reg9 = /zzk[1-7][^a-g]/;
            // console.log(reg9.test("sxzzk6j"));
            // let rega = /zzk[1-7a-z,]/;
            // console.log(rega.test("sxzzk "));
        }
        {
            // let reg1=/^zzk$/;
            // console.log(reg1.test("zzk1"));
            // let reg2=/\bzzk\b/;
            // console.log(reg2.test("he zzk 123"));
            // let reg3=/\Bzzk\B/;
            // console.log(reg3.test("he zzk 123"));
            // let reg4=/^zzk\w?$/;
            // console.log(reg4.test("zzk_"));
            // let reg5=/^zzk\d*$/;
            // console.log(reg5.test("zzk123"));
            // let reg6=/^zzk\s+$/;
            // console.log(reg6.test("zzk "));
            // let reg7=/^zzk[1-9]{3,5}$/;
            // console.log(reg7.test("zzk1356"));
            // let reg8=/^zzk[1-9]{3,}$/;
            // console.log(reg8.test("zzk12"));
            // let reg9=/^zzk[1-9]{3}$/;
            // console.log(reg9.test("zzk135"));
            // let rega=/^#([0-9a-f]{3}|[0-9a-f]{6})$/;
            // console.log(rega.test("#fff123"));
            // let regb=/^1\d{10}$/;
            // console.log(regb.test("13623416335"));
        }
        {
            let str="hello world";
            let reg=/he(ll)o/;
            console.log(reg.exec(str));//有小括号解析时，匹配两次
        }
        {
            let str ="100000";
            let reg=/10+?/;
            //用于解析匹配时量词的表现贪婪的，如果想要变得吝啬，就在量词后加一个问号
            console.log(reg.exec(str))
        }
        {
            let str="hello world";
            let reg1=/l/g;
            console.log(reg1.exec(str));
            console.log(reg1.exec(str));
            console.log(reg1.exec(str)); 
            console.log(reg1.exec(str)); 
            str=str.replace(reg1,"L");
            console.log(str);
            console.log(str.search(/l/));
            console.log(str.search(/l/i));
            let str2="hel2lo w2or3ld5";
            console.log(str2.match(/\d/g));
            console.log(str2.split(/\d/g));
        }
    </script>
</head>

<body>

</body>

</html>